<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>用户管理</title>
	<meta name="decorator" content="default"/>
	<%@include file="/WEB-INF/views/include/treeview.jsp" %>
	<style type="text/css">
		/**.ztree {overflow:auto;margin:0;_margin-top:10px;padding:10px 0 0 10px;} */
	</style>
</head>
<body>
	<sys:message content="${message}"/>
    <div id="content" class="row">
        <div id="left" class="col-xs-2" style="padding-left: 20px;padding-top: 2px;">
            <div class="box box-solid">
                <div class="box-header with-border" style="background-color: #ddd;">
                    <h3 class="box-title">组织机构</h3>
                    <div class="box-tools">
                        <button type="button" class="btn btn-default btn-sm"><i class="fa fa-refresh" onclick="refreshTree();"></i> </button>
                    </div>
                </div>
                <div class="box-body no-padding">
                    <div id="ztree" class="ztree" ></div>
                </div>
            </div>
        </div>
        <div id="right" class="col-xs-10">
            <iframe id="officeContent" src="${ctx}/sys/user/list" style="zoom: 1;width: 99%;height:800px;margin:0px;padding:0px;" frameborder="0" scrolling="yes"></iframe>
        </div>
    </div>
	<script type="text/javascript">
        var setting = { view: { showTitle: false},
            data:{
                simpleData:{enable:true,idKey:"id",pIdKey:"pId",rootPId:'0'},
                key:{title:""}
            },
            callback:{onClick:function(event, treeId, treeNode){
                var id = treeNode.id == '0' ? '' :treeNode.id;
                $('#officeContent').attr("src","${ctx}/sys/user/list?office.id="+id+"&office.name="+treeNode.name);
            }
            }
        };
		
		function refreshTree(){
			$.getJSON("${ctx}/sys/office/treeData",function(data){
				$.fn.zTree.init($("#ztree"), setting, data).expandAll(true);
			});
		}
		refreshTree();

	</script>
</body>
</html>